# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-uri-fetch
_pkgname=URI-Fetch
pkgver=0.15
pkgrel=5
pkgdesc='Smart URI fetching/caching.'
arch=('any')
url='https://metacpan.org/pod/URI::Fetch'
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl>=5.8.1' 'perl-class-errorhandler' 'perl-libwww' 'perl-uri')
source=("http://search.cpan.org/CPAN/authors/id/N/NE/NEILB/$_pkgname-$pkgver.tar.gz")
sha512sums=('eb630a628920cdee005a7a4be5c82da635050905a6cbb12b06721a11921f54b72d0c307306a413b95e43def7859eb5ac4e0d9d9400c4fe86750cc71210db7203')

prepare() {
  cd "$_pkgname-$pkgver"

  sed -i 's|5.008_001|5.008|g' Makefile.PL
}

build() {
  (
    export PERL_MM_USE_DEFAULT=1 PERL5LIB="" PERL_AUTOINSTALL=--skipdeps \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'"     \
    PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
    MODULEBUILDRC=/dev/null

    cd "$_pkgname-$pkgver"

    perl Makefile.PL

    make
  )
}

package() {
  cd "$_pkgname-$pkgver"

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

